import os.path
import pygame as pg

class ResManSettings(object):
    def __init__(self, base_dir):
        self.base_dir = base_dir
        self.tex_dir = 'Textures'
        self.tex_ext = 'png'
        
class ResMan(object):
    def __init__(self, settings):
        self.settings = settings
        self.textures = {}
        
    def load_textures(self, names_list):
        for tex_name in names_list:
            if self.textures.get(tex_name) is not True:
                full_tex_name = '{0}.{1}'.format(tex_name, self.settings.tex_ext)
                print(full_tex_name)
                full_path = os.path.join(self.settings.base_dir, self.settings.tex_dir, full_tex_name)
                try:
                    self.textures[tex_name] = pg.image.load(full_path).convert_alpha()
                except pg.error as msg:
                    print(msg)

    def get_texture(self, key):
        return self.textures.get(key)

